﻿using System.Data.Entity.ModelConfiguration;
using ModelLayer;

namespace DataLayer.Configurations
{
    public class AspNetUserConfig : EntityTypeConfiguration<AspNetUser>
    {

        public AspNetUserConfig()
        {
            HasKey(x => x.Id);

         

           HasMany(e => e.AspNetUserClaims)
                .WithRequired(e => e.AspNetUser)
                .HasForeignKey(e => e.UserId);

           HasMany(e => e.AspNetUserLogins)
                .WithRequired(e => e.AspNetUser)
                .HasForeignKey(e => e.UserId);

           HasMany(e => e.Users)
                .WithOptional(e => e.AspNetUser)
                .HasForeignKey(e => e.IdentityId);

            ToTable("AspNetUser");
        }
    }
}
